﻿namespace IS.Projecto.Modelo
{
    using System.Collections.Generic;
    using System.Xml.Serialization;

    public class UnidadeCurricular : Entidade
    {
        public string Nome { get; set; }
        public int CursoId { get; set; }
        [XmlIgnore]
        public IList<int> Turnos { get; set; }

        public bool Equals(UnidadeCurricular other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.CursoId == CursoId && other.Id == Id;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (UnidadeCurricular)) return false;
            return Equals((UnidadeCurricular) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((Nome != null ? Nome.GetHashCode() : 0)*397) ^ CursoId;
            }
        }

        public static bool operator ==(UnidadeCurricular left, UnidadeCurricular right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(UnidadeCurricular left, UnidadeCurricular right)
        {
            return !Equals(left, right);
        }
    }
}